package com.frx.leetoffer.dayone;

import java.util.Stack;

/**
 * Created with IDEA
 * 用两个栈来实现队列
 * @author: xrf
 * @Date: 2019/11/17
 * @Time: 11:21
 */
public class StackQueueTest {
    public static void main(String[] args){

    }
    Stack<Integer> stack1 = new Stack<>();
    Stack<Integer> stack2 = new Stack<>();

    public void push(int node){
       stack1.push(node);
    }
    public int pop(){
        while (stack2.isEmpty()){
            while (!stack1.isEmpty()){
                stack2.push(stack1.pop());
            }
        }
        int res = stack2.pop();
        return res;
    }

}
